﻿(function () {
    require.config({
        baseUrl: '/Modules/NineSeas.Dashboard/Scripts',
        paths: {}
    });

    var modules = [
        "/Modules/Orchard.jQuery/scripts/jquery-1.9.1.min.js",
        "/Modules/Orchard.AngularJS/scripts/angular.min.js",
        "/Modules/Orchard.AngularJS/scripts/angular-route.min.js",
        "/Modules/Orchard.AngularJS/scripts/angular-resource.min.js",
        "/Modules/Orchard.AngularJS/scripts/angular-sanitize.min.js",
        "/Modules/Orchard.AngularJS/scripts/angular-cookies.min.js",
        "/Modules/NineSeas.Dashboard/Scripts/libs/ui-bootstrap.min.js",
        "common",
        "services/notifyService",
        "services/authenticationService",
        "services/authenticationDialogs",
        "localization.min",
        "app.min",
        "services/accountService.min",
        "controllers/mainController.min"
    ];

    var progress = 0;
    var step = (100 - 10) / modules.length;
    var getModule = function () {
        var module = modules.shift();

        progress += step;
        if ($) {
            $("#splash").find(".meter").css("width", progress + "%");
        }

        if (module) require([module], function () {
            getModule();
        });
        else {
            angular.bootstrap(document, ['dashboard']);
        }
    };

    getModule();
})();